import { createRouter, createWebHistory } from 'vue-router'
import Login from "@/views/Login.vue";
import Layout from "@/layout/Layout";
import User from "@/views/User";
import Register from "@/views/Register";
import Person from "@/views/Person";
import Book from "@/views/Book";

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect:'/user',
    children:[
      {
        path: 'user',
        name: 'User',
        component: User,
      },
      {
        path: 'book',
        name: 'Book',
        component: Book,
      },
      {
        path: 'person',
        name: 'Person',
        component: Person,
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
